package com.web.kdl.dao.report;

import com.web.kdl.pojo.Vo.site.SiteMonVo;
import com.web.kdl.pojo.Vo.site.SumSiteCurrentPowerVo;
import com.web.kdl.pojo.dto.FlywheelMainDto;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zq
 * @date 2022/6/29 15:11
 */
@Mapper
@Repository
public interface Report1Dao {


    List<FlywheelMainDto> getAllDatailSite(@Param("tableName") String tableName);


    @Select("SELECT *" +
            "FROM `${tableName}` " +
            " ORDER BY TIME DESC Limit 20")
    @Results({
            @Result(property = "subSite", column = "sub_site"),
            @Result(property = "deviceName", column = "device_name"),
            @Result(property = "event", column = "alert_value"),
            @Result(property = "time", column = "time"),
    })
    List<SiteMonVo> getSiteMonMsg(@Param("tableName") String tableName);

    //     系统容量 （4个飞轮总和） 总放电量 累计放电量 站点最大功率
    List<FlywheelMainDto> getWheelForSite(String tableName);


    @Select("SELECT status_value " +
            "FROM `${tableName}` " +
            "WHERE status_name = '系统运行状态反馈' " +
            "ORDER BY time DESC " +
            "limit 1")
    String getFlyWheelStatus(@Param("tableName") String statusTable);

    /**
     *
     * @param tableList 案例 ： table_data_{siteName}_{matrixName}_flywheel{number}
     * @return
     */
    List<SumSiteCurrentPowerVo> getCurrentPower(List<String> tableList);
}
